<template>
	<view>
		<uni-section title="请添加门头照" type="line">
						<view>
							<image mode="aspectFit" :src="mtrc" @click="mt()"></image>
						</view>
		</uni-section>
			<u-form :model="form" ref="uForm">
				<u-form-item label="门店简称"><u-input v-model="form.name" /></u-form-item>
				<u-form-item label="营业状态"><u-input v-model="form.status" type="select" /></u-form-item>
				<u-form-item label="简介"><u-input v-model="form.info" /></u-form-item>
				<u-form-item label="营业时间起"><u-input v-model="form.a" /></u-form-item>
				<u-form-item label="营业时间止">
					
					
				</u-form-item>
				<u-checkbox-group @change="checkboxGroupChange">
							<u-checkbox 
								@change="checkboxChange" 
								v-model="item.checked" 
								v-for="(item, index) in list" :key="index" 
								:name="item.name"
							>{{item.name}}</u-checkbox>
						</u-checkbox-group>
						{{this.form.type}}
				<u-form-item label="联系人"><u-input v-model="form.contacts" /></u-form-item>
				<u-form-item label="联系电话"><u-input v-model="form.phone" type="select" /></u-form-item>
				<u-form-item label="地址"><u-input v-model="form.address" /></u-form-item>
				
			</u-form>
			<u-button @click="add">保存</u-button>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				fuwu:'',
				list: [
								{
									name: '洗车',
									checked: false,
									disabled: false
								},
								{
									name: '吃饭',
									checked: false,
									disabled: false
								},
								{
									name: '加水',
									checked: false,
									disabled: false
								},
								{
									name: '住宿',
									checked: false,
									disabled: false
								},
								{
									name: '其他',
									checked: false,
									disabled: false
								}
							],
				params: {
									year: true,
									month: true,
									day: true,
									hour: false,
									minute: false,
									second: false
								},
				show: true,
				mode: 'date',
				form: {
								name: '',
								info: '',
								status: '',
								type:'',
								contacts:'',
								phone:'',
								address:'',
								zid:this.$store.state.id
								
							},
							
							
							radio: '',
							switchVal: false,
							mtrc:"../../static/iconfont/添加.png"
					
			};
		},
		methods:{
			change(e) {
							console.log(e);
						},
			checkboxChange(e) {
									console.log(e);
								},
			checkboxGroupChange(e) {
					this.form.type=e+","
					console.log(e+1);
				},
				mt(){
					var this_=this;
					uni.chooseImage({
						count: 1, //默认9
						sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
						sourceType: ['album'], //从相册选择
						success: function (res) {
							this_.mtrc=res.tempFilePaths[0]
							console.info(this_.mtrc)
							
						}
					})
				},
			add(){
				const baseUrl="http://localhost:8888"
				uni.request({
					url:baseUrl+'/s/operate/add',
					method:"POST",
					data:this.form
				}).then(res=>{
					console.log(this.$store.state.id)
					uni.switchTab({
						url:'/pages/mycompany/mycompany'
					})
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
